libkovan
1
The kovan standard library
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
motors.hpp
Go to the documentation of this file.
1
/**************************************************************************
2
* Copyright 2012 KISS Institute for Practical Robotics *
3
* *
4
* This file is part of libkovan. *
5
* *
6
* libkovan is free software: you can redistribute it and/or modify *
7
* it under the terms of the GNU General Public License as published by *
8
* the Free Software Foundation, either version 2 of the License, or *
9
* (at your option) any later version. *
10
* *
11
* libkovan is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
* GNU General Public License for more details. *
15
* *
16
* You should have received a copy of the GNU General Public License *
17
* along with libkovan. Check the LICENSE file in the project root. *
18
* If not, see <http://www.gnu.org/licenses/>. *
19
**************************************************************************/
20
29
#ifndef _MOTORS_HPP_
30
#define _MOTORS_HPP_
31
32
#include "
port.hpp
"
33
#include "
sensor.hpp
"
34
#include "
export.h
"
35
42
class
EXPORT_SYM
Motor
43
{
44
public
:
49
Motor
(
const
port_t
& port)
throw
();
50
51
void
clearPositionCounter();
52
53
void
moveAtVelocity(
const
short
& velocity);
54
void
moveToPosition(
const
short
& speed,
const
int
& goalPos);
55
void
moveRelativePosition(
const
short
& speed,
const
int
& deltaPos);
56
57
void
setPidGains(
const
short
& p,
const
short
& i,
const
short
& d,
const
short
& pd,
const
short
&
id
,
const
short
& dd);
58
void
pidGains(
short
& p,
short
& i,
short
& d,
short
& pd,
short
&
id
,
short
& dd);
59
60
void
freeze
();
61
66
bool
isMotorDone()
const
;
67
73
void
blockMotorDone()
const
;
74
80
void
forward();
81
87
void
backward();
88
93
void
motor
(
int
percent);
94
98
void
off
();
99
104
const
port_t
& port()
const
;
105
106
private
:
107
port_t
m_port;
108
};
109
115
class
EXPORT_SYM
BackEMF
:
public
Sensor
<int>
116
{
117
public
:
118
BackEMF
(
const
unsigned
char
& port);
119
virtual
int
value
()
const
;
120
unsigned
char
port()
const
;
121
122
private
:
123
unsigned
char
m_port;
124
};
125
126
#endif
include
kovan
motors.hpp
Generated on Mon Aug 19 2013 00:33:00 for libkovan by
1.8.4